# 单分支
if [ $? != 0 ]
then
    echo last command failed
fi

# 一行写法
if ps -ef | grep -q ssh;  then echo hello; fi

# 双分支
read -p 'Enter a number: ' n
if [ $n -gt 0 ]
then
    echo positive
else
    echo negative/zero
fi

# 多分支
if [ $n -lt 0 ]
then
    echo negative
elif [ $n -eq 0 ]
then
    echo zero
else
    echo positive
fi
